import { Column, Entity, Index, OneToMany } from 'typeorm';
import { CommonEntity } from '../../../../util/entity/common.entity';
import { DictSon } from '../../dict-son/entities/dict-son.entity';

@Entity('sys_dict')
export class Dict extends CommonEntity {
  @Column({ comment: '名称', length: 30 })
  name: string;

  @Index({ unique: true })
  @Column({ comment: '编码', length: 30 })
  code: string;

  @Column({ default: 1, comment: '排序' })
  sort?: number;

  @OneToMany(() => DictSon, (dictSon) => dictSon.dict)
  dictSons: DictSon[];
}
